<template>
  <div class="dashboard">
    <div class="page-header">
      <h2>仪表板</h2>
    </div>
    
    <!-- 统计卡片 -->
    <el-row :gutter="20" class="stats-row">
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon user">
              <el-icon size="24"><User /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">1,234</div>
              <div class="stat-label">用户总数</div>
            </div>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon order">
              <el-icon size="24"><Document /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">5,678</div>
              <div class="stat-label">订单总数</div>
            </div>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon revenue">
              <el-icon size="24"><Money /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">¥89,012</div>
              <div class="stat-label">总收入</div>
            </div>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="6">
        <el-card class="stat-card">
          <div class="stat-content">
            <div class="stat-icon growth">
              <el-icon size="24"><DataLine /></el-icon>
            </div>
            <div class="stat-info">
              <div class="stat-number">+12.5%</div>
              <div class="stat-label">增长率</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    
    <!-- 图表区域 -->
    <el-row :gutter="20" class="charts-row">
      <el-col :span="12">
        <el-card>
          <template #header>
            <span>访问趋势</span>
          </template>
          <div class="chart-placeholder">
            <el-icon size="48" color="#ccc"><DataLine /></el-icon>
            <p>图表区域 - 可集成 ECharts</p>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="12">
        <el-card>
          <template #header>
            <span>用户分布</span>
          </template>
          <div class="chart-placeholder">
            <el-icon size="48" color="#ccc"><DataLine /></el-icon>
            <p>图表区域 - 可集成 ECharts</p>
          </div>
        </el-card>
      </el-col>
    </el-row>
    
    <!-- 快捷操作 -->
    <el-card>
      <template #header>
        <span>快捷操作</span>
      </template>
      <el-row :gutter="20">
        <el-col :span="4">
          <div class="quick-action" @click="$router.push('/users')">
            <el-icon size="32"><User /></el-icon>
            <span>用户管理</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="quick-action" @click="$router.push('/roles')">
            <el-icon size="32"><UserFilled /></el-icon>
            <span>角色管理</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="quick-action" @click="$router.push('/permissions')">
            <el-icon size="32"><Lock /></el-icon>
            <span>权限管理</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="quick-action">
            <el-icon size="32"><Setting /></el-icon>
            <span>系统设置</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="quick-action">
            <el-icon size="32"><DataLine /></el-icon>
            <span>数据分析</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="quick-action">
            <el-icon size="32"><Tools /></el-icon>
            <span>工具箱</span>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script setup>
import {
  User,
  Document,
  Money,
  TrendCharts,
  PieChart,
  UserFilled,
  Lock,
  Setting,
  DataLine,
  Tools
} from '@element-plus/icons-vue'
</script>

<style scoped>
.dashboard {
  padding: 0;
}

.page-header {
  margin-bottom: 20px;
}

.stats-row {
  margin-bottom: 20px;
}

.stat-card {
  cursor: pointer;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-content {
  display: flex;
  align-items: center;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  color: white;
}

.stat-icon.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.order {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.revenue {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.growth {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-info {
  flex: 1;
}

.stat-number {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  color: #666;
}

.charts-row {
  margin-bottom: 20px;
}

.chart-placeholder {
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #999;
}

.chart-placeholder p {
  margin-top: 10px;
  font-size: 14px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
}

.quick-action:hover {
  background: #f5f5f5;
  color: #409eff;
  transform: translateY(-2px);
}

.quick-action span {
  margin-top: 10px;
  font-size: 14px;
}
</style>
